package com.xiaoyung.easyisapisdk.common.file.domain;

import java.util.ArrayList;
import java.util.List;

import com.xiaoyung.easyisapisdk.common.util.StringUtils;



public class ExcelSheetData {
	//@ApiModelProperty("sheetName")
	private String sheetName;
	
	//@ApiModelProperty("columns")
	private List<ExcelSheetColumn> columns;//key title type
	
	//@ApiModelProperty("data")
	private List<Object> data;
	
	public List<ExcelSheetColumn> getColumns() {
		return columns;
	}

	public void setColumns(List<ExcelSheetColumn> columns) {
		this.columns = columns;
	}
	
	public void setColumns(String columnsStr) {
		if(!StringUtils.isEmpty(columnsStr)) {
			List<ExcelSheetColumn>  list = new ArrayList<> ();
			String[] columns = columnsStr.split(",");
			for (int i = 0; i < columns.length; i++) {
				String[] arr = columns[i].split(":");//key:title
				String key = arr[0];
				String title = arr.length > 1 ? arr[1] : null;
				list.add(new ExcelSheetColumn(key,title));
			}
			this.columns = list;
		}
	}
	
	
	public List<Object> getData() {//Map<String, Object> bean
		return data;
	}

	public void setData(List<Object> data) {
		this.data = data;
	}

	public String getSheetName() {
		return sheetName;
	}

	public void setSheetName(String sheetName) {
		this.sheetName = sheetName;
	}
	
	
}
